package com.example.forestapp

import android.os.Bundle
import android.widget.ImageButton
import androidx.appcompat.app.AppCompatActivity
import com.google.android.material.tabs.TabLayout

class ForestDetailActivity : AppCompatActivity() {
    private lateinit var tabLayout: TabLayout
    private lateinit var btnBack: ImageButton

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_forest_detail)

        tabLayout = findViewById(R.id.tab_layout)
        btnBack = findViewById(R.id.btn_back)

        setupViews()
        loadForestData()
    }

    private fun setupViews() {
        btnBack.setOnClickListener {
            finish()
        }

        tabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
            override fun onTabSelected(tab: TabLayout.Tab?) {
                when (tab?.position) {
                    0 -> showBasicInfo()
                    1 -> showAerialPhotos()
                    2 -> showWorkers()
                    3 -> showHistory()
                }
            }

            override fun onTabUnselected(tab: TabLayout.Tab?) {}
            override fun onTabReselected(tab: TabLayout.Tab?) {}
        })
    }

    private fun loadForestData() {
        val forestId = intent.getStringExtra("forest_id")
        // TODO: 根据林班ID加载数据
    }

    private fun showBasicInfo() {
        // TODO: 显示基础信息
    }

    private fun showAerialPhotos() {
        // TODO: 显示航拍图
    }

    private fun showWorkers() {
        // TODO: 显示作业人员
    }

    private fun showHistory() {
        // TODO: 显示历史记录
    }
} 